class Province:
  """A base class for all province types."""
  
  Type = ""
  SupplyCenter = False
  Occupied = False 
  Name = ""
  Id = ""
 
  def __init__(self,name="",id=""):
    """Default constructor"""
    self.Name = name
    self.Id = id
    self.SupplyCenter = False
    self.Occupied = False
    self.initialize()

  def initialize(self):
    """Function for initializing data members. More important in sublcasses."""
    self.Type = ""
  
  def __repr__(self):
    """Returns a programmer-friendly description of the Province."""
    return 'type: ' + self.Type + ' | name: ' + self.Name + ' | abrev: ' + \
      self.Id + ' | supp: ' + str(self.SupplyCenter) + ' | occ: ' + \
      str(self.Occupied)

  def __eq__(self,other):
    """Allows two provinces to be compared to each other."""
    return self.Id == other.Id and \
           self.Type == other.Type and \
           self.SupplyCenter == other.SupplyCenter and \
           self.Occupied == other.Occupied and \
           self.Name == other.Name

  def __hash__(self):
     """ Genereates a unique hash for further comparison ( this is needed for
         Provinces to be stored in dictionaries. """
     return hash(self.Id) ^ hash(self.Type) ^ hash(self.SupplyCenter) ^ \
            hash(self.Occupied) ^ hash(self.Name)
